//
// CPortal.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;
import org.ryzom.nel.misc.IStream;

public class CPortal {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CPortal(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CPortal obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CPortal(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CPortal() {
    this(nel3dJNI.new_CPortal(), true);
  }

  public boolean clipPyramid(CVector observer, SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t pyramid) {
    return nel3dJNI.CPortal_clipPyramid(swigCPtr, this, CVector.getCPtr(observer), observer, SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t.getCPtr(pyramid));
  }

  public boolean isInFront(CVector v) {
    return nel3dJNI.CPortal_isInFront(swigCPtr, this, CVector.getCPtr(v), v);
  }

  public void resetClusterLinks() {
    nel3dJNI.CPortal_resetClusterLinks(swigCPtr, this);
  }

  public boolean setCluster(CCluster cluster) {
    return nel3dJNI.CPortal_setCluster(swigCPtr, this, CCluster.getCPtr(cluster), cluster);
  }

  public short getNbCluster() {
    return nel3dJNI.CPortal_getNbCluster(swigCPtr, this);
  }

  public CCluster getCluster(long pos) {
    long cPtr = nel3dJNI.CPortal_getCluster(swigCPtr, this, pos);
    return (cPtr == 0) ? null : new CCluster(cPtr, false);
  }

  public boolean setPoly(Vector_CVector poly) {
    return nel3dJNI.CPortal_setPoly(swigCPtr, this, Vector_CVector.getCPtr(poly), poly);
  }

  public void getPoly(Vector_CVector dest) {
    nel3dJNI.CPortal_getPoly__SWIG_0(swigCPtr, this, Vector_CVector.getCPtr(dest), dest);
  }

  public Vector_CVector getPoly() {
    return new Vector_CVector(nel3dJNI.CPortal_getPoly__SWIG_1(swigCPtr, this), false);
  }

  public void serial(IStream f) {
    nel3dJNI.CPortal_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void setWorldMatrix(SWIGTYPE_p_NLMISC__CMatrix WM) {
    nel3dJNI.CPortal_setWorldMatrix(swigCPtr, this, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(WM));
  }

  public void setName(SWIGTYPE_p_std__string name) {
    nel3dJNI.CPortal_setName(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(name));
  }

  public String getName() {
    return nel3dJNI.CPortal_getName(swigCPtr, this);
  }

  public void open(boolean opened) {
    nel3dJNI.CPortal_open(swigCPtr, this, opened);
  }

  public boolean isOpened() {
    return nel3dJNI.CPortal_isOpened(swigCPtr, this);
  }

  public void setOcclusionModel(String occlusionModel) {
    nel3dJNI.CPortal_setOcclusionModel(swigCPtr, this, occlusionModel);
  }

  public String getOcclusionModel() {
    return nel3dJNI.CPortal_getOcclusionModel(swigCPtr, this);
  }

  public SWIGTYPE_p_NLMISC__TStringId getOcclusionModelId() {
    return new SWIGTYPE_p_NLMISC__TStringId(nel3dJNI.CPortal_getOcclusionModelId(swigCPtr, this), true);
  }

  public void setOpenOcclusionModel(String occlusionModel) {
    nel3dJNI.CPortal_setOpenOcclusionModel(swigCPtr, this, occlusionModel);
  }

  public String getOpenOcclusionModel() {
    return nel3dJNI.CPortal_getOpenOcclusionModel(swigCPtr, this);
  }

  public SWIGTYPE_p_NLMISC__TStringId getOpenOcclusionModelId() {
    return new SWIGTYPE_p_NLMISC__TStringId(nel3dJNI.CPortal_getOpenOcclusionModelId(swigCPtr, this), true);
  }

  public boolean clipRay(CVector start, CVector end) {
    return nel3dJNI.CPortal_clipRay(swigCPtr, this, CVector.getCPtr(start), start, CVector.getCPtr(end), end);
  }

}
